<?php

namespace App\Http\Controllers;

//这个不行 use Illuminate\Http\Request;  //命名空间的三元素:常量、方法、类

//这个和下面的都可以 use Illuminate\Support\Facades\Request;
  //在blog\config\app.php查看有无
use Request;

use Illuminate\Support\Facades\Request as Requests;

use App\Http\Controllers\Controller;

use Illuminate\Support\Facades\Validator;
//use DB;
//use App\Home\Member;


class TestController extends Controller
{
    
    public function test13(Request $request){
        if (Request::method() == 'POST') {
            //自动验证
            //$validator = Validator::make($request->all() ,[
                $this -> validate($request,[
                'name' => 'bail|required|min:2|max:20',
                'age' => 'bail|required|integer|min:1|max:200',
                'email'=> 'bail|required|email',
                'content' => 'bail|required|max:500'
            ]);
        }else{
            return view('home.test.test13');
        }
        /*if ($validator->fails()) {
                return redirect('home/test/test13')
                            ->withErrors($validator)
                            ->withInput();*/
        
         /*echo Request::method();
        return view('home.test.test13');*/
   }
}



